
// 研判标准
export const tables = {
  isSelectFlag: false, // 是否展示选择器
  compRef: "gjxm",
  isSequenceFlag: false, // 是否展示序号
  autoHeight: true,
  isShowPage: false, // 是否展示分页
  loading: false,
  tableData: [],
  columns: [
    {
      prop: "dangerName",
      label: "类别",
      align: "center"
    },
    {
      prop: "warningLvName",
      label: "级别",
      align: "center"
    },
    {
      prop: "startCondition",
      label: "启动条件",
      align: "left",
      "min-width": "350px"
    }
  ],
  tableAttr: {
    // "max-height": "295px",
    // height: "295px",
    stripe: false,
    border: true,
    fit: true,
    "span-method": ({ row, column, rowIndex, columnIndex }) => {
      let contactDot = 0;
      let contactDots = 0;
      const spanArr = [];
      const spanArrs = [];
      tables.tableData.forEach((item, index) => {
        if (index === 0) {
          spanArr.push(1);
          spanArrs.push(1);
        } else {
          if (item.dangerName === tables.tableData[index - 1].dangerName) {
            spanArr[contactDot] += 1;
            spanArr.push(0);
          } else {
            contactDot = index;
            spanArr.push(1);
          }
          if (item.warningLvName === tables.tableData[index - 1].warningLvName) {
            spanArrs[contactDots] += 1;
            spanArrs.push(0);
          } else {
            contactDots = index;
            spanArrs.push(1);
          }
        }
      });
      if ([0].includes(columnIndex)) {
        if (spanArr[rowIndex]) {
          return {
            rowspan: spanArr[rowIndex],
            colspan: 1
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0
          };
        }
      } else if ([1].includes(columnIndex)) {
        if (spanArrs[rowIndex]) {
          return {
            rowspan: spanArrs[rowIndex],
            colspan: 1
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0
          };
        }
      }

    },
    "show-header": true,
    "highlight-current-row": true,
    "cell-style": {
      "font-size": "16px"
    },
    "header-cell-style": {
      "text-align": "center",
      "background-color": "#B1C8F9",
      border: "1px solid #ccc",
      "font-size": "16px"
    }
  }
};

// 人员选择前
export const AffectedUsers = {
  isSelectFlag: true, // 是否展示选择器
  compRef: "gjxm",
  isSequenceFlag: true, // 是否展示序号
  isShowPage: true, // 是否展示分页
  loading: false,
  actions: [
    {
      id: "dialogVisible",
      text: "关联地图",
      type: "primary",
      btnAttr: { size: "small" }
    }
  ],
  tableData: [],
  columns: [
    {
      prop: "facilityName",
      label: "设备名称",
      align: "center"
      // "min-width": "230px"
    },
    {
      prop: "facilityTypeName",
      label: "设备类型",
      align: "center"
      // "min-width": "230px"
    },
    {
      prop: "unitName",
      label: "所属单位",
      align: "center"
    },
    {
      prop: "voltageClasses",
      label: "电压等级",
      align: "center"
      // "min-width": "230px"
    },
    {
      prop: "operationUnitName",
      label: "运维单位",
      align: "center"
      // "min-width": "230px"
    },
    {
      prop: "operationGroupName",
      label: "运维班组",
      align: "center"
    },
    {
      prop: "facilityState",
      label: "设备状态",
      align: "center"
      // "min-width": "230px"
    },
    {
      prop: "revolveDate",
      label: "投运日期",
      align: "center"
    },
    {
      prop: "property",
      label: "资产性质",
      align: "center",
      "min-width": "140px"
    }
  ],
  tableAttr: {
    "max-height": "460px",
    height: "460px",
    stripe: false,
    border: true,
    fit: true,
    "show-header": true,
    "highlight-current-row": true,
    "cell-style": {
      "font-size": "16px"
    },
    "header-cell-style": {
      "text-align": "center",
      "background-color": "#B1C8F9",
      border: "1px solid #ccc",
      "font-size": "16px"
    }
  },
  paginationAtrrs: {
    total: 0,
    "background": true,
    layout: "prev, pager, next",
    "current-page": 1,
    "page-size": 10
  }
};
// 黄色
export const tableYellow = {
  compRef: "gjxm",
  isShowPage: false, // 是否展示分页
  isSequenceFlag: true, // 是否展示序号
  loading: false,
  tableData: [],
  columns: [
    {
      prop: "startCondition",
      label: "启动条件",
      align: "left"
      // "min-width": "230px"
    }
  ],
  tableAttr: {
    "max-height": "200px",
    height: "200px",
    border: true,
    fit: true,
    stripe: true,
    "show-header": true,
    "highlight-current-row": true,
    "cell-style": {
      "font-size": "16px",
      "color": "#fff",
      "border": "none"
    },
    "row-style": {
      "background": "#18283a"
    },
    "header-cell-style": {
      "text-align": "center",
      "background-color": "transparent",
      "font-size": "16px",
      "border": "none",
      "color": "#fff"
    }
  }
};
// 橙色
export const tableOrange = {
  compRef: "gjxm",
  isShowPage: false, // 是否展示分页
  isSequenceFlag: true, // 是否展示序号
  loading: false,
  tableData: [],
  columns: [
    {
      prop: "startCondition",
      label: "启动条件",
      align: "left"
      // "min-width": "230px"
    }
  ],
  tableAttr: {
    "max-height": "200px",
    height: "200px",
    border: true,
    fit: true,
    stripe: true,
    "show-header": true,
    "highlight-current-row": true,
    "cell-style": {
      "font-size": "16px",
      "color": "#fff",
      "border": "none"
    },
    "row-style": {
      "background": "#18283a"
    },
    "header-cell-style": {
      "text-align": "center",
      "background-color": "transparent",
      "font-size": "16px",
      "border": "none",
      "color": "#fff"
    }
  }
};
// 红色
export const tableRed = {
  compRef: "gjxm",
  isShowPage: false, // 是否展示分页
  isSequenceFlag: true, // 是否展示序号
  loading: false,
  tableData: [],
  columns: [
    {
      prop: "startCondition",
      label: "启动条件",
      align: "left"
      // "min-width": "230px"
    }
  ],
  tableAttr: {
    "max-height": "200px",
    height: "200px",
    border: true,
    stripe: true,
    "show-header": true,
    "highlight-current-row": true,
    "cell-style": {
      "font-size": "16px",
      "color": "#fff",
      "border": "none"
    },
    "row-style": {
      "background": "#18283a"
    },
    "header-cell-style": {
      "text-align": "center",
      "background-color": "transparent",
      "font-size": "16px",
      "border": "none",
      "color": "#fff"
    }
  }
};
